<template>
  <view class="container">

    <view class="tabs">
      <text :class="['tab', currentTab === '已上架' ? 'active' : '']" @click="switchTab('已上架')">已上架</text>
      <text :class="['tab', currentTab === '未上架' ? 'active' : '']" @click="switchTab('未上架')">未上架</text>
    </view>

    <view class="event-list">
      <view class="event-item" v-for="(event, index) in events" :key="index" v-if="event.status === currentTab">
        <view class="event-main">
          <text>{{ event.title }}</text>
          <text class="event-date">{{ event.date }}</text>
        </view>
        <button class="action-btn">{{ event.action }}</button>
      </view>
    </view>
    
    <button class="publish-btn">+ 发布活动</button>
  </view>
</template>

<script>
export default {
  data() {
    return {
      currentTab: '已上架',
      events: [
        { title: '阳春三月油江南活动开始报名了', date: '2023-03-10 11:09', status: '已上架', action: '下架' },
        { title: '阳春三月油江南活动开始报名了', date: '2023-03-10 11:09', status: '未上架', action: '上架' },
		{ title: '阳春三月油江南活动开始报名了', date: '2023-03-10 11:09', status: '已上架', action: '下架' },
		{ title: '阳春三月油江南活动开始报名了', date: '2023-03-10 11:09', status: '已上架', action: '上架' },
		{ title: '阳春三月油江南活动开始报名了', date: '2023-03-10 11:09', status: '已上架', action: '上架' }
      ]
    };
  },
  methods: {
    switchTab(tab) {
      this.currentTab = tab;
    }
  }
}
</script>

<style>
.container {
  padding: 20rpx;
}

.header {
  background-color: #007AFF;
  padding: 20rpx;
  text-align: center;
}

.title {
  color: white;
  font-size: 36rpx;
}

.tabs {
  display: flex;
  justify-content: center;
  background-color: green;
}

.tab {
  padding: 20rpx;
  font-size: 32rpx;
  color: #333;
}

.active {
  color: #007AFF;
  border-bottom: 2rpx solid #007AFF;
}

.event-list {
  margin-top: 20rpx;
}

.event-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: red;
  padding: 20rpx;
  margin-bottom: 20rpx;
  border-radius: 10rpx;
}

.event-main {
  display: flex;
  flex-direction: column;
}

.event-date {
  color: #999;
  font-size: 28rpx;
}

.action-btn {
  background-color: #007AFF;
  color: white;
  padding: 10rpx 20rpx;
  border-radius: 20rpx;
  font-size: 28rpx;
}

.publish-btn {
  width: 100%;
  height: 80rpx;
  background-color: #007AFF;
  color: white;
  font-size: 32rpx;
  text-align: center;
  line-height: 80rpx;
  border-radius: 40rpx;
  position: fixed;
  bottom: 20rpx;
  left: 0;
}
</style>
